

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>LLVM Bitcode File Format &#8212; LLVM 9 documentation</title>
    <link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/language_data.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="LLVM Block Frequency Terminology" href="BlockFrequencyTerminology.html" />
    <link rel="prev" title="MemorySSA" href="MemorySSA.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head><body>
<div class="logo">
  <a href="index.html">
    <img src="_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="BlockFrequencyTerminology.html" title="LLVM Block Frequency Terminology"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="MemorySSA.html" title="MemorySSA"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>

        <li class="nav-item nav-item-this"><a href="">LLVM Bitcode File Format</a></li> 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="llvm-bitcode-file-format">
<h1>LLVM Bitcode File Format<a class="headerlink" href="#llvm-bitcode-file-format" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#abstract" id="id9">Abstract</a></p></li>
<li><p><a class="reference internal" href="#overview" id="id10">Overview</a></p></li>
<li><p><a class="reference internal" href="#bitstream-format" id="id11">Bitstream Format</a></p>
<ul>
<li><p><a class="reference internal" href="#magic-numbers" id="id12">Magic Numbers</a></p></li>
<li><p><a class="reference internal" href="#primitives" id="id13">Primitives</a></p>
<ul>
<li><p><a class="reference internal" href="#fixed-width-value" id="id14">Fixed Width Integers</a></p></li>
<li><p><a class="reference internal" href="#variable-width-value" id="id15">Variable Width Integers</a></p></li>
<li><p><a class="reference internal" href="#bit-characters" id="id16">6-bit characters</a></p></li>
<li><p><a class="reference internal" href="#word-alignment" id="id17">Word Alignment</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#abbreviation-ids" id="id18">Abbreviation IDs</a></p></li>
<li><p><a class="reference internal" href="#blocks" id="id19">Blocks</a></p>
<ul>
<li><p><a class="reference internal" href="#enter-subblock-encoding" id="id20">ENTER_SUBBLOCK Encoding</a></p></li>
<li><p><a class="reference internal" href="#end-block-encoding" id="id21">END_BLOCK Encoding</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#data-records" id="id22">Data Records</a></p>
<ul>
<li><p><a class="reference internal" href="#unabbrev-record-encoding" id="id23">UNABBREV_RECORD Encoding</a></p></li>
<li><p><a class="reference internal" href="#abbreviated-record-encoding" id="id24">Abbreviated Record Encoding</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#abbreviations" id="id25">Abbreviations</a></p>
<ul>
<li><p><a class="reference internal" href="#define-abbrev-encoding" id="id26">DEFINE_ABBREV Encoding</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#standard-block" id="id27">Standard Blocks</a></p>
<ul>
<li><p><a class="reference internal" href="#blockinfo-block" id="id28">#0 - BLOCKINFO Block</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="#bitcode-wrapper-format" id="id29">Bitcode Wrapper Format</a></p></li>
<li><p><a class="reference internal" href="#native-object-file-wrapper-format" id="id30">Native Object File Wrapper Format</a></p></li>
<li><p><a class="reference internal" href="#llvm-ir-encoding" id="id31">LLVM IR Encoding</a></p>
<ul>
<li><p><a class="reference internal" href="#basics" id="id32">Basics</a></p>
<ul>
<li><p><a class="reference internal" href="#llvm-ir-magic-number" id="id33">LLVM IR Magic Number</a></p></li>
<li><p><a class="reference internal" href="#signed-vbrs" id="id34">Signed VBRs</a></p></li>
<li><p><a class="reference internal" href="#llvm-ir-blocks" id="id35">LLVM IR Blocks</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#module-block-contents" id="id36">MODULE_BLOCK Contents</a></p>
<ul>
<li><p><a class="reference internal" href="#module-code-version-record" id="id37">MODULE_CODE_VERSION Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-triple-record" id="id38">MODULE_CODE_TRIPLE Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-datalayout-record" id="id39">MODULE_CODE_DATALAYOUT Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-asm-record" id="id40">MODULE_CODE_ASM Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-sectionname-record" id="id41">MODULE_CODE_SECTIONNAME Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-deplib-record" id="id42">MODULE_CODE_DEPLIB Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-globalvar-record" id="id43">MODULE_CODE_GLOBALVAR Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-function-record" id="id44">MODULE_CODE_FUNCTION Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-alias-record" id="id45">MODULE_CODE_ALIAS Record</a></p></li>
<li><p><a class="reference internal" href="#module-code-gcname-record" id="id46">MODULE_CODE_GCNAME Record</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#paramattr-block-contents" id="id47">PARAMATTR_BLOCK Contents</a></p>
<ul>
<li><p><a class="reference internal" href="#paramattr-code-entry-record" id="id48">PARAMATTR_CODE_ENTRY Record</a></p></li>
<li><p><a class="reference internal" href="#paramattr-code-entry-old-record" id="id49">PARAMATTR_CODE_ENTRY_OLD Record</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#paramattr-group-block-contents" id="id50">PARAMATTR_GROUP_BLOCK Contents</a></p>
<ul>
<li><p><a class="reference internal" href="#paramattr-grp-code-entry-record" id="id51">PARAMATTR_GRP_CODE_ENTRY Record</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#type-block-contents" id="id52">TYPE_BLOCK Contents</a></p>
<ul>
<li><p><a class="reference internal" href="#type-code-numentry-record" id="id53">TYPE_CODE_NUMENTRY Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-void-record" id="id54">TYPE_CODE_VOID Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-half-record" id="id55">TYPE_CODE_HALF Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-float-record" id="id56">TYPE_CODE_FLOAT Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-double-record" id="id57">TYPE_CODE_DOUBLE Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-label-record" id="id58">TYPE_CODE_LABEL Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-opaque-record" id="id59">TYPE_CODE_OPAQUE Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-integer-record" id="id60">TYPE_CODE_INTEGER Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-pointer-record" id="id61">TYPE_CODE_POINTER Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-function-old-record" id="id62">TYPE_CODE_FUNCTION_OLD Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-array-record" id="id63">TYPE_CODE_ARRAY Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-vector-record" id="id64">TYPE_CODE_VECTOR Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-x86-fp80-record" id="id65">TYPE_CODE_X86_FP80 Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-fp128-record" id="id66">TYPE_CODE_FP128 Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-ppc-fp128-record" id="id67">TYPE_CODE_PPC_FP128 Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-metadata-record" id="id68">TYPE_CODE_METADATA Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-x86-mmx-record" id="id69">TYPE_CODE_X86_MMX Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-struct-anon-record" id="id70">TYPE_CODE_STRUCT_ANON Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-struct-name-record" id="id71">TYPE_CODE_STRUCT_NAME Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-struct-named-record" id="id72">TYPE_CODE_STRUCT_NAMED Record</a></p></li>
<li><p><a class="reference internal" href="#type-code-function-record" id="id73">TYPE_CODE_FUNCTION Record</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#constants-block-contents" id="id74">CONSTANTS_BLOCK Contents</a></p></li>
<li><p><a class="reference internal" href="#function-block-contents" id="id75">FUNCTION_BLOCK Contents</a></p></li>
<li><p><a class="reference internal" href="#value-symtab-block-contents" id="id76">VALUE_SYMTAB_BLOCK Contents</a></p></li>
<li><p><a class="reference internal" href="#metadata-block-contents" id="id77">METADATA_BLOCK Contents</a></p></li>
<li><p><a class="reference internal" href="#metadata-attachment-contents" id="id78">METADATA_ATTACHMENT Contents</a></p></li>
<li><p><a class="reference internal" href="#strtab-block-contents" id="id79">STRTAB_BLOCK Contents</a></p></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="abstract">
<h2><a class="toc-backref" href="#id9">Abstract</a><a class="headerlink" href="#abstract" title="Permalink to this headline">¶</a></h2>
<p>This document describes the LLVM bitstream file format and the encoding of the
LLVM IR into it.</p>
</div>
<div class="section" id="overview">
<h2><a class="toc-backref" href="#id10">Overview</a><a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
<p>What is commonly known as the LLVM bitcode file format (also, sometimes
anachronistically known as bytecode) is actually two things: a <a class="reference internal" href="#bitstream-container-format">bitstream
container format</a> and an <a class="reference internal" href="#encoding-of-llvm-ir">encoding of LLVM IR</a> into the container format.</p>
<p>The bitstream format is an abstract encoding of structured data, very similar to
XML in some ways.  Like XML, bitstream files contain tags, and nested
structures, and you can parse the file without having to understand the tags.
Unlike XML, the bitstream format is a binary encoding, and unlike XML it
provides a mechanism for the file to self-describe “abbreviations”, which are
effectively size optimizations for the content.</p>
<p>LLVM IR files may be optionally embedded into a <a class="reference internal" href="#wrapper">wrapper</a> structure, or in a
<a class="reference internal" href="#native-object-file">native object file</a>. Both of these mechanisms make it easy to embed extra
data along with LLVM IR files.</p>
<p>This document first describes the LLVM bitstream format, describes the wrapper
format, then describes the record structure used by LLVM IR files.</p>
</div>
<div class="section" id="bitstream-format">
<span id="bitstream-container-format"></span><h2><a class="toc-backref" href="#id11">Bitstream Format</a><a class="headerlink" href="#bitstream-format" title="Permalink to this headline">¶</a></h2>
<p>The bitstream format is literally a stream of bits, with a very simple
structure.  This structure consists of the following concepts:</p>
<ul class="simple">
<li><p>A “<a class="reference internal" href="#magic-number">magic number</a>” that identifies the contents of the stream.</p></li>
<li><p>Encoding <a class="reference internal" href="#primitives">primitives</a> like variable bit-rate integers.</p></li>
<li><p><a class="reference internal" href="#blocks">Blocks</a>, which define nested content.</p></li>
<li><p><a class="reference internal" href="#data-records">Data Records</a>, which describe entities within the file.</p></li>
<li><p>Abbreviations, which specify compression optimizations for the file.</p></li>
</ul>
<p>Note that the <a class="reference internal" href="CommandGuide/llvm-bcanalyzer.html"><span class="doc">llvm-bcanalyzer</span></a> tool can be
used to dump and inspect arbitrary bitstreams, which is very useful for
understanding the encoding.</p>
<div class="section" id="magic-numbers">
<span id="magic-number"></span><h3><a class="toc-backref" href="#id12">Magic Numbers</a><a class="headerlink" href="#magic-numbers" title="Permalink to this headline">¶</a></h3>
<p>The first four bytes of a bitstream are used as an application-specific magic
number.  Generic bitcode tools may look at the first four bytes to determine
whether the stream is a known stream type.  However, these tools should <em>not</em>
determine whether a bitstream is valid based on its magic number alone.  New
application-specific bitstream formats are being developed all the time; tools
should not reject them just because they have a hitherto unseen magic number.</p>
</div>
<div class="section" id="primitives">
<span id="id1"></span><h3><a class="toc-backref" href="#id13">Primitives</a><a class="headerlink" href="#primitives" title="Permalink to this headline">¶</a></h3>
<p>A bitstream literally consists of a stream of bits, which are read in order
starting with the least significant bit of each byte.  The stream is made up of
a number of primitive values that encode a stream of unsigned integer values.
These integers are encoded in two ways: either as <a class="reference internal" href="#fixed-width-integers">Fixed Width Integers</a> or as
<a class="reference internal" href="#variable-width-integers">Variable Width Integers</a>.</p>
<div class="section" id="fixed-width-value">
<span id="fixed-width-integers"></span><span id="id2"></span><h4><a class="toc-backref" href="#id14">Fixed Width Integers</a><a class="headerlink" href="#fixed-width-value" title="Permalink to this headline">¶</a></h4>
<p>Fixed-width integer values have their low bits emitted directly to the file.
For example, a 3-bit integer value encodes 1 as 001.  Fixed width integers are
used when there are a well-known number of options for a field.  For example,
boolean values are usually encoded with a 1-bit wide integer.</p>
</div>
<div class="section" id="variable-width-value">
<span id="variable-width-integer"></span><span id="variable-width-integers"></span><span id="id3"></span><h4><a class="toc-backref" href="#id15">Variable Width Integers</a><a class="headerlink" href="#variable-width-value" title="Permalink to this headline">¶</a></h4>
<p>Variable-width integer (VBR) values encode values of arbitrary size, optimizing
for the case where the values are small.  Given a 4-bit VBR field, any 3-bit
value (0 through 7) is encoded directly, with the high bit set to zero.  Values
larger than N-1 bits emit their bits in a series of N-1 bit chunks, where all
but the last set the high bit.</p>
<p>For example, the value 27 (0x1B) is encoded as 1011 0011 when emitted as a vbr4
value.  The first set of four bits indicates the value 3 (011) with a
continuation piece (indicated by a high bit of 1).  The next word indicates a
value of 24 (011 &lt;&lt; 3) with no continuation.  The sum (3+24) yields the value
27.</p>
</div>
<div class="section" id="bit-characters">
<span id="char6-encoded-value"></span><h4><a class="toc-backref" href="#id16">6-bit characters</a><a class="headerlink" href="#bit-characters" title="Permalink to this headline">¶</a></h4>
<p>6-bit characters encode common characters into a fixed 6-bit field.  They
represent the following characters with the following 6-bit values:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s1">&#39;a&#39;</span> <span class="o">..</span> <span class="s1">&#39;z&#39;</span> <span class="o">---</span>  <span class="mi">0</span> <span class="o">..</span> <span class="mi">25</span>
<span class="s1">&#39;A&#39;</span> <span class="o">..</span> <span class="s1">&#39;Z&#39;</span> <span class="o">---</span> <span class="mi">26</span> <span class="o">..</span> <span class="mi">51</span>
<span class="s1">&#39;0&#39;</span> <span class="o">..</span> <span class="s1">&#39;9&#39;</span> <span class="o">---</span> <span class="mi">52</span> <span class="o">..</span> <span class="mi">61</span>
       <span class="s1">&#39;.&#39;</span> <span class="o">---</span> <span class="mi">62</span>
       <span class="s1">&#39;_&#39;</span> <span class="o">---</span> <span class="mi">63</span>
</pre></div>
</div>
<p>This encoding is only suitable for encoding characters and strings that consist
only of the above characters.  It is completely incapable of encoding characters
not in the set.</p>
</div>
<div class="section" id="word-alignment">
<h4><a class="toc-backref" href="#id17">Word Alignment</a><a class="headerlink" href="#word-alignment" title="Permalink to this headline">¶</a></h4>
<p>Occasionally, it is useful to emit zero bits until the bitstream is a multiple
of 32 bits.  This ensures that the bit position in the stream can be represented
as a multiple of 32-bit words.</p>
</div>
</div>
<div class="section" id="abbreviation-ids">
<h3><a class="toc-backref" href="#id18">Abbreviation IDs</a><a class="headerlink" href="#abbreviation-ids" title="Permalink to this headline">¶</a></h3>
<p>A bitstream is a sequential series of <a class="reference internal" href="#blocks">Blocks</a> and <a class="reference internal" href="#data-records">Data Records</a>.  Both of
these start with an abbreviation ID encoded as a fixed-bitwidth field.  The
width is specified by the current block, as described below.  The value of the
abbreviation ID specifies either a builtin ID (which have special meanings,
defined below) or one of the abbreviation IDs defined for the current block by
the stream itself.</p>
<p>The set of builtin abbrev IDs is:</p>
<ul class="simple">
<li><p>0 - <a class="reference internal" href="#end-block">END_BLOCK</a> — This abbrev ID marks the end of the current block.</p></li>
<li><p>1 - <a class="reference internal" href="#enter-subblock">ENTER_SUBBLOCK</a> — This abbrev ID marks the beginning of a new
block.</p></li>
<li><p>2 - <a class="reference internal" href="#define-abbrev">DEFINE_ABBREV</a> — This defines a new abbreviation.</p></li>
<li><p>3 - <a class="reference internal" href="#unabbrev-record">UNABBREV_RECORD</a> — This ID specifies the definition of an
unabbreviated record.</p></li>
</ul>
<p>Abbreviation IDs 4 and above are defined by the stream itself, and specify an
<a class="reference internal" href="#abbreviated-record-encoding">abbreviated record encoding</a>.</p>
</div>
<div class="section" id="blocks">
<span id="id4"></span><h3><a class="toc-backref" href="#id19">Blocks</a><a class="headerlink" href="#blocks" title="Permalink to this headline">¶</a></h3>
<p>Blocks in a bitstream denote nested regions of the stream, and are identified by
a content-specific id number (for example, LLVM IR uses an ID of 12 to represent
function bodies).  Block IDs 0-7 are reserved for <a class="reference internal" href="#standard-blocks">standard blocks</a> whose
meaning is defined by Bitcode; block IDs 8 and greater are application
specific. Nested blocks capture the hierarchical structure of the data encoded
in it, and various properties are associated with blocks as the file is parsed.
Block definitions allow the reader to efficiently skip blocks in constant time
if the reader wants a summary of blocks, or if it wants to efficiently skip data
it does not understand.  The LLVM IR reader uses this mechanism to skip function
bodies, lazily reading them on demand.</p>
<p>When reading and encoding the stream, several properties are maintained for the
block.  In particular, each block maintains:</p>
<ol class="arabic simple">
<li><p>A current abbrev id width.  This value starts at 2 at the beginning of the
stream, and is set every time a block record is entered.  The block entry
specifies the abbrev id width for the body of the block.</p></li>
<li><p>A set of abbreviations.  Abbreviations may be defined within a block, in
which case they are only defined in that block (neither subblocks nor
enclosing blocks see the abbreviation).  Abbreviations can also be defined
inside a <a class="reference internal" href="#blockinfo">BLOCKINFO</a> block, in which case they are defined in all blocks
that match the ID that the <code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> block is describing.</p></li>
</ol>
<p>As sub blocks are entered, these properties are saved and the new sub-block has
its own set of abbreviations, and its own abbrev id width.  When a sub-block is
popped, the saved values are restored.</p>
<div class="section" id="enter-subblock-encoding">
<span id="enter-subblock"></span><h4><a class="toc-backref" href="#id20">ENTER_SUBBLOCK Encoding</a><a class="headerlink" href="#enter-subblock-encoding" title="Permalink to this headline">¶</a></h4>
<p><span class="raw-html"><tt></span>
[ENTER_SUBBLOCK, blockid<sub>vbr8</sub>, newabbrevlen<sub>vbr4</sub>, &lt;align32bits&gt;, blocklen_32]
<span class="raw-html"></tt></span></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ENTER_SUBBLOCK</span></code> abbreviation ID specifies the start of a new block
record.  The <code class="docutils literal notranslate"><span class="pre">blockid</span></code> value is encoded as an 8-bit VBR identifier, and
indicates the type of block being entered, which can be a <a class="reference internal" href="#standard-block">standard block</a> or
an application-specific block.  The <code class="docutils literal notranslate"><span class="pre">newabbrevlen</span></code> value is a 4-bit VBR, which
specifies the abbrev id width for the sub-block.  The <code class="docutils literal notranslate"><span class="pre">blocklen</span></code> value is a
32-bit aligned value that specifies the size of the subblock in 32-bit
words. This value allows the reader to skip over the entire block in one jump.</p>
</div>
<div class="section" id="end-block-encoding">
<span id="end-block"></span><h4><a class="toc-backref" href="#id21">END_BLOCK Encoding</a><a class="headerlink" href="#end-block-encoding" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[END_BLOCK,</span> <span class="pre">&lt;align32bits&gt;]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">END_BLOCK</span></code> abbreviation ID specifies the end of the current block record.
Its end is aligned to 32-bits to ensure that the size of the block is an even
multiple of 32-bits.</p>
</div>
</div>
<div class="section" id="data-records">
<span id="id5"></span><h3><a class="toc-backref" href="#id22">Data Records</a><a class="headerlink" href="#data-records" title="Permalink to this headline">¶</a></h3>
<p>Data records consist of a record code and a number of (up to) 64-bit integer
values.  The interpretation of the code and values is application specific and
may vary between different block types.  Records can be encoded either using an
unabbrev record, or with an abbreviation.  In the LLVM IR format, for example,
there is a record which encodes the target triple of a module.  The code is
<code class="docutils literal notranslate"><span class="pre">MODULE_CODE_TRIPLE</span></code>, and the values of the record are the ASCII codes for the
characters in the string.</p>
<div class="section" id="unabbrev-record-encoding">
<span id="unabbrev-record"></span><h4><a class="toc-backref" href="#id23">UNABBREV_RECORD Encoding</a><a class="headerlink" href="#unabbrev-record-encoding" title="Permalink to this headline">¶</a></h4>
<p><span class="raw-html"><tt></span>
[UNABBREV_RECORD, code<sub>vbr6</sub>, numops<sub>vbr6</sub>, op0<sub>vbr6</sub>, op1<sub>vbr6</sub>, …]
<span class="raw-html"></tt></span></p>
<p>An <code class="docutils literal notranslate"><span class="pre">UNABBREV_RECORD</span></code> provides a default fallback encoding, which is both
completely general and extremely inefficient.  It can describe an arbitrary
record by emitting the code and operands as VBRs.</p>
<p>For example, emitting an LLVM IR target triple as an unabbreviated record
requires emitting the <code class="docutils literal notranslate"><span class="pre">UNABBREV_RECORD</span></code> abbrevid, a vbr6 for the
<code class="docutils literal notranslate"><span class="pre">MODULE_CODE_TRIPLE</span></code> code, a vbr6 for the length of the string, which is equal
to the number of operands, and a vbr6 for each character.  Because there are no
letters with values less than 32, each letter would need to be emitted as at
least a two-part VBR, which means that each letter would require at least 12
bits.  This is not an efficient encoding, but it is fully general.</p>
</div>
<div class="section" id="abbreviated-record-encoding">
<span id="id6"></span><h4><a class="toc-backref" href="#id24">Abbreviated Record Encoding</a><a class="headerlink" href="#abbreviated-record-encoding" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[&lt;abbrevid&gt;,</span> <span class="pre">fields...]</span></code></p>
<p>An abbreviated record is a abbreviation id followed by a set of fields that are
encoded according to the <a class="reference internal" href="#abbreviation-definition">abbreviation definition</a>.  This allows records to be
encoded significantly more densely than records encoded with the
<a class="reference internal" href="#unabbrev-record">UNABBREV_RECORD</a> type, and allows the abbreviation types to be specified in
the stream itself, which allows the files to be completely self describing.  The
actual encoding of abbreviations is defined below.</p>
<p>The record code, which is the first field of an abbreviated record, may be
encoded in the abbreviation definition (as a literal operand) or supplied in the
abbreviated record (as a Fixed or VBR operand value).</p>
</div>
</div>
<div class="section" id="abbreviations">
<span id="abbreviation-definition"></span><h3><a class="toc-backref" href="#id25">Abbreviations</a><a class="headerlink" href="#abbreviations" title="Permalink to this headline">¶</a></h3>
<p>Abbreviations are an important form of compression for bitstreams.  The idea is
to specify a dense encoding for a class of records once, then use that encoding
to emit many records.  It takes space to emit the encoding into the file, but
the space is recouped (hopefully plus some) when the records that use it are
emitted.</p>
<p>Abbreviations can be determined dynamically per client, per file. Because the
abbreviations are stored in the bitstream itself, different streams of the same
format can contain different sets of abbreviations according to the needs of the
specific stream.  As a concrete example, LLVM IR files usually emit an
abbreviation for binary operators.  If a specific LLVM module contained no or
few binary operators, the abbreviation does not need to be emitted.</p>
<div class="section" id="define-abbrev-encoding">
<span id="define-abbrev"></span><h4><a class="toc-backref" href="#id26">DEFINE_ABBREV Encoding</a><a class="headerlink" href="#define-abbrev-encoding" title="Permalink to this headline">¶</a></h4>
<p><span class="raw-html"><tt></span>
[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1, …]
<span class="raw-html"></tt></span></p>
<p>A <code class="docutils literal notranslate"><span class="pre">DEFINE_ABBREV</span></code> record adds an abbreviation to the list of currently defined
abbreviations in the scope of this block.  This definition only exists inside
this immediate block — it is not visible in subblocks or enclosing blocks.
Abbreviations are implicitly assigned IDs sequentially starting from 4 (the
first application-defined abbreviation ID).  Any abbreviations defined in a
<code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> record for the particular block type receive IDs first, in order,
followed by any abbreviations defined within the block itself.  Abbreviated data
records reference this ID to indicate what abbreviation they are invoking.</p>
<p>An abbreviation definition consists of the <code class="docutils literal notranslate"><span class="pre">DEFINE_ABBREV</span></code> abbrevid followed
by a VBR that specifies the number of abbrev operands, then the abbrev operands
themselves.  Abbreviation operands come in three forms.  They all start with a
single bit that indicates whether the abbrev operand is a literal operand (when
the bit is 1) or an encoding operand (when the bit is 0).</p>
<ol class="arabic simple">
<li><p>Literal operands — <span class="raw-html"><tt></span> [1<sub>1</sub>, litvalue<sub>vbr8</sub>] <span class="raw-html"></tt></span> — Literal operands specify that the value in
the result is always a single specific value.  This specific value is emitted
as a vbr8 after the bit indicating that it is a literal operand.</p></li>
<li><p>Encoding info without data — <span class="raw-html"><tt></span> [0<sub>1</sub>, encoding<sub>3</sub>] <span class="raw-html"></tt></span> — Operand encodings that do not have extra data
are just emitted as their code.</p></li>
<li><p>Encoding info with data — <span class="raw-html"><tt></span> [0<sub>1</sub>, encoding<sub>3</sub>, value<sub>vbr5</sub>] <span class="raw-html"></tt></span> — Operand encodings that do
have extra data are emitted as their code, followed by the extra data.</p></li>
</ol>
<p>The possible operand encodings are:</p>
<ul class="simple">
<li><p>Fixed (code 1): The field should be emitted as a <a class="reference internal" href="#fixed-width-value">fixed-width value</a>, whose
width is specified by the operand’s extra data.</p></li>
<li><p>VBR (code 2): The field should be emitted as a <a class="reference internal" href="#variable-width-value">variable-width value</a>, whose
width is specified by the operand’s extra data.</p></li>
<li><p>Array (code 3): This field is an array of values.  The array operand has no
extra data, but expects another operand to follow it, indicating the element
type of the array.  When reading an array in an abbreviated record, the first
integer is a vbr6 that indicates the array length, followed by the encoded
elements of the array.  An array may only occur as the last operand of an
abbreviation (except for the one final operand that gives the array’s
type).</p></li>
<li><p>Char6 (code 4): This field should be emitted as a <a class="reference internal" href="#char6-encoded-value">char6-encoded value</a>.
This operand type takes no extra data. Char6 encoding is normally used as an
array element type.</p></li>
<li><p>Blob (code 5): This field is emitted as a vbr6, followed by padding to a
32-bit boundary (for alignment) and an array of 8-bit objects.  The array of
bytes is further followed by tail padding to ensure that its total length is a
multiple of 4 bytes.  This makes it very efficient for the reader to decode
the data without having to make a copy of it: it can use a pointer to the data
in the mapped in file and poke directly at it.  A blob may only occur as the
last operand of an abbreviation.</p></li>
</ul>
<p>For example, target triples in LLVM modules are encoded as a record of the form
<code class="docutils literal notranslate"><span class="pre">[TRIPLE,</span> <span class="pre">'a',</span> <span class="pre">'b',</span> <span class="pre">'c',</span> <span class="pre">'d']</span></code>.  Consider if the bitstream emitted the
following abbrev entry:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="n">Fixed</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>
<span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="n">Array</span><span class="p">]</span>
<span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="n">Char6</span><span class="p">]</span>
</pre></div>
</div>
<p>When emitting a record with this abbreviation, the above entry would be emitted
as:</p>
<p><span class="raw-html"><tt><blockquote></span>
[4<sub>abbrevwidth</sub>, 2<sub>4</sub>, 4<sub>vbr6</sub>, 0<sub>6</sub>, 1<sub>6</sub>, 2<sub>6</sub>, 3<sub>6</sub>]
<span class="raw-html"></blockquote></tt></span></p>
<p>These values are:</p>
<ol class="arabic simple">
<li><p>The first value, 4, is the abbreviation ID for this abbreviation.</p></li>
<li><p>The second value, 2, is the record code for <code class="docutils literal notranslate"><span class="pre">TRIPLE</span></code> records within LLVM IR
file <code class="docutils literal notranslate"><span class="pre">MODULE_BLOCK</span></code> blocks.</p></li>
<li><p>The third value, 4, is the length of the array.</p></li>
<li><p>The rest of the values are the char6 encoded values for <code class="docutils literal notranslate"><span class="pre">&quot;abcd&quot;</span></code>.</p></li>
</ol>
<p>With this abbreviation, the triple is emitted with only 37 bits (assuming a
abbrev id width of 3).  Without the abbreviation, significantly more space would
be required to emit the target triple.  Also, because the <code class="docutils literal notranslate"><span class="pre">TRIPLE</span></code> value is
not emitted as a literal in the abbreviation, the abbreviation can also be used
for any other string value.</p>
</div>
</div>
<div class="section" id="standard-block">
<span id="standard-blocks"></span><span id="id7"></span><h3><a class="toc-backref" href="#id27">Standard Blocks</a><a class="headerlink" href="#standard-block" title="Permalink to this headline">¶</a></h3>
<p>In addition to the basic block structure and record encodings, the bitstream
also defines specific built-in block types.  These block types specify how the
stream is to be decoded or other metadata.  In the future, new standard blocks
may be added.  Block IDs 0-7 are reserved for standard blocks.</p>
<div class="section" id="blockinfo-block">
<span id="blockinfo"></span><h4><a class="toc-backref" href="#id28">#0 - BLOCKINFO Block</a><a class="headerlink" href="#blockinfo-block" title="Permalink to this headline">¶</a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> block allows the description of metadata for other blocks.
The currently specified records are:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">SETBID</span> <span class="p">(</span><span class="c1">#1), blockid]</span>
<span class="p">[</span><span class="n">DEFINE_ABBREV</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span>
<span class="p">[</span><span class="n">BLOCKNAME</span><span class="p">,</span> <span class="o">...</span><span class="n">name</span><span class="o">...</span><span class="p">]</span>
<span class="p">[</span><span class="n">SETRECORDNAME</span><span class="p">,</span> <span class="n">RecordID</span><span class="p">,</span> <span class="o">...</span><span class="n">name</span><span class="o">...</span><span class="p">]</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">SETBID</span></code> record (code 1) indicates which block ID is being described.
<code class="docutils literal notranslate"><span class="pre">SETBID</span></code> records can occur multiple times throughout the block to change which
block ID is being described.  There must be a <code class="docutils literal notranslate"><span class="pre">SETBID</span></code> record prior to any
other records.</p>
<p>Standard <code class="docutils literal notranslate"><span class="pre">DEFINE_ABBREV</span></code> records can occur inside <code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> blocks, but
unlike their occurrence in normal blocks, the abbreviation is defined for blocks
matching the block ID we are describing, <em>not</em> the <code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> block
itself.  The abbreviations defined in <code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> blocks receive abbreviation
IDs as described in <a class="reference internal" href="#define-abbrev">DEFINE_ABBREV</a>.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">BLOCKNAME</span></code> record (code 2) can optionally occur in this block.  The
elements of the record are the bytes of the string name of the block.
llvm-bcanalyzer can use this to dump out bitcode files symbolically.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">SETRECORDNAME</span></code> record (code 3) can also optionally occur in this block.
The first operand value is a record ID number, and the rest of the elements of
the record are the bytes for the string name of the record.  llvm-bcanalyzer can
use this to dump out bitcode files symbolically.</p>
<p>Note that although the data in <code class="docutils literal notranslate"><span class="pre">BLOCKINFO</span></code> blocks is described as “metadata,”
the abbreviations they contain are essential for parsing records from the
corresponding blocks.  It is not safe to skip them.</p>
</div>
</div>
</div>
<div class="section" id="bitcode-wrapper-format">
<span id="wrapper"></span><h2><a class="toc-backref" href="#id29">Bitcode Wrapper Format</a><a class="headerlink" href="#bitcode-wrapper-format" title="Permalink to this headline">¶</a></h2>
<p>Bitcode files for LLVM IR may optionally be wrapped in a simple wrapper
structure.  This structure contains a simple header that indicates the offset
and size of the embedded BC file.  This allows additional information to be
stored alongside the BC file.  The structure of this file header is:</p>
<p><span class="raw-html"><tt><blockquote></span>
[Magic<sub>32</sub>, Version<sub>32</sub>, Offset<sub>32</sub>, Size<sub>32</sub>, CPUType<sub>32</sub>]
<span class="raw-html"></blockquote></tt></span></p>
<p>Each of the fields are 32-bit fields stored in little endian form (as with the
rest of the bitcode file fields).  The Magic number is always <code class="docutils literal notranslate"><span class="pre">0x0B17C0DE</span></code> and
the version is currently always <code class="docutils literal notranslate"><span class="pre">0</span></code>.  The Offset field is the offset in bytes
to the start of the bitcode stream in the file, and the Size field is the size
in bytes of the stream. CPUType is a target-specific value that can be used to
encode the CPU of the target.</p>
</div>
<div class="section" id="native-object-file-wrapper-format">
<span id="native-object-file"></span><h2><a class="toc-backref" href="#id30">Native Object File Wrapper Format</a><a class="headerlink" href="#native-object-file-wrapper-format" title="Permalink to this headline">¶</a></h2>
<p>Bitcode files for LLVM IR may also be wrapped in a native object file
(i.e. ELF, COFF, Mach-O).  The bitcode must be stored in a section of the object
file named <code class="docutils literal notranslate"><span class="pre">__LLVM,__bitcode</span></code> for MachO and <code class="docutils literal notranslate"><span class="pre">.llvmbc</span></code> for the other object
formats.  This wrapper format is useful for accommodating LTO in compilation
pipelines where intermediate objects must be native object files which contain
metadata in other sections.</p>
<p>Not all tools support this format.</p>
</div>
<div class="section" id="llvm-ir-encoding">
<span id="encoding-of-llvm-ir"></span><h2><a class="toc-backref" href="#id31">LLVM IR Encoding</a><a class="headerlink" href="#llvm-ir-encoding" title="Permalink to this headline">¶</a></h2>
<p>LLVM IR is encoded into a bitstream by defining blocks and records.  It uses
blocks for things like constant pools, functions, symbol tables, etc.  It uses
records for things like instructions, global variable descriptors, type
descriptions, etc.  This document does not describe the set of abbreviations
that the writer uses, as these are fully self-described in the file, and the
reader is not allowed to build in any knowledge of this.</p>
<div class="section" id="basics">
<h3><a class="toc-backref" href="#id32">Basics</a><a class="headerlink" href="#basics" title="Permalink to this headline">¶</a></h3>
<div class="section" id="llvm-ir-magic-number">
<h4><a class="toc-backref" href="#id33">LLVM IR Magic Number</a><a class="headerlink" href="#llvm-ir-magic-number" title="Permalink to this headline">¶</a></h4>
<p>The magic number for LLVM IR files is:</p>
<p><span class="raw-html"><tt><blockquote></span>
[‘B’<sub>8</sub>, ‘C’<sub>8</sub>, 0x0<sub>4</sub>, 0xC<sub>4</sub>, 0xE<sub>4</sub>, 0xD<sub>4</sub>]
<span class="raw-html"></blockquote></tt></span></p>
</div>
<div class="section" id="signed-vbrs">
<span id="id8"></span><h4><a class="toc-backref" href="#id34">Signed VBRs</a><a class="headerlink" href="#signed-vbrs" title="Permalink to this headline">¶</a></h4>
<p><a class="reference internal" href="#variable-width-integer">Variable Width Integer</a> encoding is an efficient way to encode arbitrary sized
unsigned values, but is an extremely inefficient for encoding signed values, as
signed values are otherwise treated as maximally large unsigned values.</p>
<p>As such, signed VBR values of a specific width are emitted as follows:</p>
<ul class="simple">
<li><p>Positive values are emitted as VBRs of the specified width, but with their
value shifted left by one.</p></li>
<li><p>Negative values are emitted as VBRs of the specified width, but the negated
value is shifted left by one, and the low bit is set.</p></li>
</ul>
<p>With this encoding, small positive and small negative values can both be emitted
efficiently. Signed VBR encoding is used in <code class="docutils literal notranslate"><span class="pre">CST_CODE_INTEGER</span></code> and
<code class="docutils literal notranslate"><span class="pre">CST_CODE_WIDE_INTEGER</span></code> records within <code class="docutils literal notranslate"><span class="pre">CONSTANTS_BLOCK</span></code> blocks.
It is also used for phi instruction operands in <a class="reference internal" href="#module-code-version">MODULE_CODE_VERSION</a> 1.</p>
</div>
<div class="section" id="llvm-ir-blocks">
<h4><a class="toc-backref" href="#id35">LLVM IR Blocks</a><a class="headerlink" href="#llvm-ir-blocks" title="Permalink to this headline">¶</a></h4>
<p>LLVM IR is defined with the following blocks:</p>
<ul class="simple">
<li><p>8 — <a class="reference internal" href="#module-block">MODULE_BLOCK</a> — This is the top-level block that contains the entire
module, and describes a variety of per-module information.</p></li>
<li><p>9 — <a class="reference internal" href="#paramattr-block">PARAMATTR_BLOCK</a> — This enumerates the parameter attributes.</p></li>
<li><p>10 — <a class="reference internal" href="#paramattr-group-block">PARAMATTR_GROUP_BLOCK</a> — This describes the attribute group table.</p></li>
<li><p>11 — <a class="reference internal" href="#constants-block">CONSTANTS_BLOCK</a> — This describes constants for a module or
function.</p></li>
<li><p>12 — <a class="reference internal" href="#function-block">FUNCTION_BLOCK</a> — This describes a function body.</p></li>
<li><p>14 — <a class="reference internal" href="#value-symtab-block">VALUE_SYMTAB_BLOCK</a> — This describes a value symbol table.</p></li>
<li><p>15 — <a class="reference internal" href="#metadata-block">METADATA_BLOCK</a> — This describes metadata items.</p></li>
<li><p>16 — <a class="reference internal" href="#metadata-attachment">METADATA_ATTACHMENT</a> — This contains records associating metadata
with function instruction values.</p></li>
<li><p>17 — <a class="reference internal" href="#type-block">TYPE_BLOCK</a> — This describes all of the types in the module.</p></li>
<li><p>23 — <a class="reference internal" href="#strtab-block">STRTAB_BLOCK</a> — The bitcode file’s string table.</p></li>
</ul>
</div>
</div>
<div class="section" id="module-block-contents">
<span id="module-block"></span><h3><a class="toc-backref" href="#id36">MODULE_BLOCK Contents</a><a class="headerlink" href="#module-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">MODULE_BLOCK</span></code> block (id 8) is the top-level block for LLVM bitcode files,
and each bitcode file must contain exactly one. In addition to records
(described below) containing information about the module, a <code class="docutils literal notranslate"><span class="pre">MODULE_BLOCK</span></code>
block may contain the following sub-blocks:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#blockinfo">BLOCKINFO</a></p></li>
<li><p><a class="reference internal" href="#paramattr-block">PARAMATTR_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#paramattr-group-block">PARAMATTR_GROUP_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#type-block">TYPE_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#value-symtab-block">VALUE_SYMTAB_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#constants-block">CONSTANTS_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#function-block">FUNCTION_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#metadata-block">METADATA_BLOCK</a></p></li>
</ul>
<div class="section" id="module-code-version-record">
<span id="module-code-version"></span><h4><a class="toc-backref" href="#id37">MODULE_CODE_VERSION Record</a><a class="headerlink" href="#module-code-version-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[VERSION,</span> <span class="pre">version#]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">VERSION</span></code> record (code 1) contains a single value indicating the format
version. Versions 0, 1 and 2 are supported at this time. The difference between
version 0 and 1 is in the encoding of instruction operands in
each <a class="reference internal" href="#function-block">FUNCTION_BLOCK</a>.</p>
<p>In version 0, each value defined by an instruction is assigned an ID
unique to the function. Function-level value IDs are assigned starting from
<code class="docutils literal notranslate"><span class="pre">NumModuleValues</span></code> since they share the same namespace as module-level
values. The value enumerator resets after each function. When a value is
an operand of an instruction, the value ID is used to represent the operand.
For large functions or large modules, these operand values can be large.</p>
<p>The encoding in version 1 attempts to avoid large operand values
in common cases. Instead of using the value ID directly, operands are
encoded as relative to the current instruction. Thus, if an operand
is the value defined by the previous instruction, the operand
will be encoded as 1.</p>
<p>For example, instead of</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>#n = load #n-1
#n+1 = icmp eq #n, #const0
br #n+1, label #(bb1), label #(bb2)
</pre></div>
</div>
<p>version 1 will encode the instructions as</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>#n = load #1
#n+1 = icmp eq #1, (#n+1)-#const0
br #1, label #(bb1), label #(bb2)
</pre></div>
</div>
<p>Note in the example that operands which are constants also use
the relative encoding, while operands like basic block labels
do not use the relative encoding.</p>
<p>Forward references will result in a negative value.
This can be inefficient, as operands are normally encoded
as unsigned VBRs. However, forward references are rare, except in the
case of phi instructions. For phi instructions, operands are encoded as
<a class="reference internal" href="#signed-vbrs">Signed VBRs</a> to deal with forward references.</p>
<p>In version 2, the meaning of module records <code class="docutils literal notranslate"><span class="pre">FUNCTION</span></code>, <code class="docutils literal notranslate"><span class="pre">GLOBALVAR</span></code>,
<code class="docutils literal notranslate"><span class="pre">ALIAS</span></code>, <code class="docutils literal notranslate"><span class="pre">IFUNC</span></code> and <code class="docutils literal notranslate"><span class="pre">COMDAT</span></code> change such that the first two operands
specify an offset and size of a string in a string table (see <a class="reference internal" href="#strtab-block-contents">STRTAB_BLOCK
Contents</a>), the function name is removed from the <code class="docutils literal notranslate"><span class="pre">FNENTRY</span></code> record in the
value symbol table, and the top-level <code class="docutils literal notranslate"><span class="pre">VALUE_SYMTAB_BLOCK</span></code> may only contain
<code class="docutils literal notranslate"><span class="pre">FNENTRY</span></code> records.</p>
</div>
<div class="section" id="module-code-triple-record">
<h4><a class="toc-backref" href="#id38">MODULE_CODE_TRIPLE Record</a><a class="headerlink" href="#module-code-triple-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[TRIPLE,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">TRIPLE</span></code> record (code 2) contains a variable number of values representing
the bytes of the <code class="docutils literal notranslate"><span class="pre">target</span> <span class="pre">triple</span></code> specification string.</p>
</div>
<div class="section" id="module-code-datalayout-record">
<h4><a class="toc-backref" href="#id39">MODULE_CODE_DATALAYOUT Record</a><a class="headerlink" href="#module-code-datalayout-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[DATALAYOUT,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">DATALAYOUT</span></code> record (code 3) contains a variable number of values
representing the bytes of the <code class="docutils literal notranslate"><span class="pre">target</span> <span class="pre">datalayout</span></code> specification string.</p>
</div>
<div class="section" id="module-code-asm-record">
<h4><a class="toc-backref" href="#id40">MODULE_CODE_ASM Record</a><a class="headerlink" href="#module-code-asm-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[ASM,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ASM</span></code> record (code 4) contains a variable number of values representing
the bytes of <code class="docutils literal notranslate"><span class="pre">module</span> <span class="pre">asm</span></code> strings, with individual assembly blocks separated
by newline (ASCII 10) characters.</p>
</div>
<div class="section" id="module-code-sectionname-record">
<span id="module-code-sectionname"></span><h4><a class="toc-backref" href="#id41">MODULE_CODE_SECTIONNAME Record</a><a class="headerlink" href="#module-code-sectionname-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[SECTIONNAME,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">SECTIONNAME</span></code> record (code 5) contains a variable number of values
representing the bytes of a single section name string. There should be one
<code class="docutils literal notranslate"><span class="pre">SECTIONNAME</span></code> record for each section name referenced (e.g., in global
variable or function <code class="docutils literal notranslate"><span class="pre">section</span></code> attributes) within the module. These records
can be referenced by the 1-based index in the <em>section</em> fields of <code class="docutils literal notranslate"><span class="pre">GLOBALVAR</span></code>
or <code class="docutils literal notranslate"><span class="pre">FUNCTION</span></code> records.</p>
</div>
<div class="section" id="module-code-deplib-record">
<h4><a class="toc-backref" href="#id42">MODULE_CODE_DEPLIB Record</a><a class="headerlink" href="#module-code-deplib-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[DEPLIB,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">DEPLIB</span></code> record (code 6) contains a variable number of values representing
the bytes of a single dependent library name string, one of the libraries
mentioned in a <code class="docutils literal notranslate"><span class="pre">deplibs</span></code> declaration.  There should be one <code class="docutils literal notranslate"><span class="pre">DEPLIB</span></code> record
for each library name referenced.</p>
</div>
<div class="section" id="module-code-globalvar-record">
<h4><a class="toc-backref" href="#id43">MODULE_CODE_GLOBALVAR Record</a><a class="headerlink" href="#module-code-globalvar-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[GLOBALVAR,</span> <span class="pre">strtab</span> <span class="pre">offset,</span> <span class="pre">strtab</span> <span class="pre">size,</span> <span class="pre">pointer</span> <span class="pre">type,</span> <span class="pre">isconst,</span> <span class="pre">initid,</span> <span class="pre">linkage,</span> <span class="pre">alignment,</span> <span class="pre">section,</span> <span class="pre">visibility,</span> <span class="pre">threadlocal,</span> <span class="pre">unnamed_addr,</span> <span class="pre">externally_initialized,</span> <span class="pre">dllstorageclass,</span> <span class="pre">comdat,</span> <span class="pre">attributes,</span> <span class="pre">preemptionspecifier]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">GLOBALVAR</span></code> record (code 7) marks the declaration or definition of a
global variable. The operand fields are:</p>
<ul class="simple">
<li><p><em>strtab offset</em>, <em>strtab size</em>: Specifies the name of the global variable.
See <a class="reference internal" href="#strtab-block-contents">STRTAB_BLOCK Contents</a>.</p></li>
<li><p><em>pointer type</em>: The type index of the pointer type used to point to this
global variable</p></li>
<li><p><em>isconst</em>: Non-zero if the variable is treated as constant within the module,
or zero if it is not</p></li>
<li><p><em>initid</em>: If non-zero, the value index of the initializer for this variable,
plus 1.</p></li>
</ul>
<ul class="simple" id="linkage-type">
<li><p><em>linkage</em>: An encoding of the linkage type for this variable:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">external</span></code>: code 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">weak</span></code>: code 1</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">appending</span></code>: code 2</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">internal</span></code>: code 3</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">linkonce</span></code>: code 4</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dllimport</span></code>: code 5</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dllexport</span></code>: code 6</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">extern_weak</span></code>: code 7</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">common</span></code>: code 8</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">private</span></code>: code 9</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">weak_odr</span></code>: code 10</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">linkonce_odr</span></code>: code 11</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">available_externally</span></code>: code 12</p></li>
<li><p>deprecated : code 13</p></li>
<li><p>deprecated : code 14</p></li>
</ul>
</li>
<li><p>alignment*: The logarithm base 2 of the variable’s requested alignment, plus 1</p></li>
<li><p><em>section</em>: If non-zero, the 1-based section index in the table of
<a class="reference internal" href="#module-code-sectionname">MODULE_CODE_SECTIONNAME</a> entries.</p></li>
</ul>
<ul class="simple" id="visibility">
<li><p><em>visibility</em>: If present, an encoding of the visibility of this variable:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">default</span></code>: code 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hidden</span></code>: code 1</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">protected</span></code>: code 2</p></li>
</ul>
</li>
</ul>
<ul class="simple" id="bcthreadlocal">
<li><p><em>threadlocal</em>: If present, an encoding of the thread local storage mode of the
variable:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">thread</span> <span class="pre">local</span></code>: code 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">thread</span> <span class="pre">local;</span> <span class="pre">default</span> <span class="pre">TLS</span> <span class="pre">model</span></code>: code 1</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">localdynamic</span></code>: code 2</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">initialexec</span></code>: code 3</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">localexec</span></code>: code 4</p></li>
</ul>
</li>
</ul>
<ul class="simple" id="bcunnamedaddr">
<li><p><em>unnamed_addr</em>: If present, an encoding of the <code class="docutils literal notranslate"><span class="pre">unnamed_addr</span></code> attribute of this
variable:</p>
<ul>
<li><p>not <code class="docutils literal notranslate"><span class="pre">unnamed_addr</span></code>: code 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">unnamed_addr</span></code>: code 1</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">local_unnamed_addr</span></code>: code 2</p></li>
</ul>
</li>
</ul>
<ul class="simple" id="bcdllstorageclass">
<li><p><em>dllstorageclass</em>: If present, an encoding of the DLL storage class of this variable:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">default</span></code>: code 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dllimport</span></code>: code 1</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dllexport</span></code>: code 2</p></li>
</ul>
</li>
<li><p><em>comdat</em>: An encoding of the COMDAT of this function</p></li>
<li><p><em>attributes</em>: If nonzero, the 1-based index into the table of AttributeLists.</p></li>
</ul>
<ul class="simple" id="bcpreemptionspecifier">
<li><p><em>preemptionspecifier</em>: If present, an encoding of the runtime preemption specifier of this variable:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">dso_preemptable</span></code>: code 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dso_local</span></code>: code 1</p></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="module-code-function-record">
<span id="function"></span><h4><a class="toc-backref" href="#id44">MODULE_CODE_FUNCTION Record</a><a class="headerlink" href="#module-code-function-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[FUNCTION,</span> <span class="pre">strtab</span> <span class="pre">offset,</span> <span class="pre">strtab</span> <span class="pre">size,</span> <span class="pre">type,</span> <span class="pre">callingconv,</span> <span class="pre">isproto,</span> <span class="pre">linkage,</span> <span class="pre">paramattr,</span> <span class="pre">alignment,</span> <span class="pre">section,</span> <span class="pre">visibility,</span> <span class="pre">gc,</span> <span class="pre">prologuedata,</span> <span class="pre">dllstorageclass,</span> <span class="pre">comdat,</span> <span class="pre">prefixdata,</span> <span class="pre">personalityfn,</span> <span class="pre">preemptionspecifier]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">FUNCTION</span></code> record (code 8) marks the declaration or definition of a
function. The operand fields are:</p>
<ul class="simple">
<li><p><em>strtab offset</em>, <em>strtab size</em>: Specifies the name of the function.
See <a class="reference internal" href="#strtab-block-contents">STRTAB_BLOCK Contents</a>.</p></li>
<li><p><em>type</em>: The type index of the function type describing this function</p></li>
<li><p><em>callingconv</em>: The calling convention number:
* <code class="docutils literal notranslate"><span class="pre">ccc</span></code>: code 0
* <code class="docutils literal notranslate"><span class="pre">fastcc</span></code>: code 8
* <code class="docutils literal notranslate"><span class="pre">coldcc</span></code>: code 9
* <code class="docutils literal notranslate"><span class="pre">webkit_jscc</span></code>: code 12
* <code class="docutils literal notranslate"><span class="pre">anyregcc</span></code>: code 13
* <code class="docutils literal notranslate"><span class="pre">preserve_mostcc</span></code>: code 14
* <code class="docutils literal notranslate"><span class="pre">preserve_allcc</span></code>: code 15
* <code class="docutils literal notranslate"><span class="pre">swiftcc</span></code> : code 16
* <code class="docutils literal notranslate"><span class="pre">cxx_fast_tlscc</span></code>: code 17
* <code class="docutils literal notranslate"><span class="pre">x86_stdcallcc</span></code>: code 64
* <code class="docutils literal notranslate"><span class="pre">x86_fastcallcc</span></code>: code 65
* <code class="docutils literal notranslate"><span class="pre">arm_apcscc</span></code>: code 66
* <code class="docutils literal notranslate"><span class="pre">arm_aapcscc</span></code>: code 67
* <code class="docutils literal notranslate"><span class="pre">arm_aapcs_vfpcc</span></code>: code 68</p></li>
<li><p>isproto*: Non-zero if this entry represents a declaration rather than a
definition</p></li>
<li><p><em>linkage</em>: An encoding of the <a class="reference internal" href="#linkage-type">linkage type</a> for this function</p></li>
<li><p><em>paramattr</em>: If nonzero, the 1-based parameter attribute index into the table
of <a class="reference internal" href="#paramattr-code-entry">PARAMATTR_CODE_ENTRY</a> entries.</p></li>
<li><p><em>alignment</em>: The logarithm base 2 of the function’s requested alignment, plus
1</p></li>
<li><p><em>section</em>: If non-zero, the 1-based section index in the table of
<a class="reference internal" href="#module-code-sectionname">MODULE_CODE_SECTIONNAME</a> entries.</p></li>
<li><p><em>visibility</em>: An encoding of the <a class="reference internal" href="#visibility">visibility</a> of this function</p></li>
<li><p><em>gc</em>: If present and nonzero, the 1-based garbage collector index in the table
of <a class="reference internal" href="#module-code-gcname">MODULE_CODE_GCNAME</a> entries.</p></li>
<li><p><em>unnamed_addr</em>: If present, an encoding of the
<a class="reference internal" href="#bcunnamedaddr"><span class="std std-ref">unnamed_addr</span></a> attribute of this function</p></li>
<li><p><em>prologuedata</em>: If non-zero, the value index of the prologue data for this function,
plus 1.</p></li>
<li><p><em>dllstorageclass</em>: An encoding of the
<a class="reference internal" href="#bcdllstorageclass"><span class="std std-ref">dllstorageclass</span></a> of this function</p></li>
<li><p><em>comdat</em>: An encoding of the COMDAT of this function</p></li>
<li><p><em>prefixdata</em>: If non-zero, the value index of the prefix data for this function,
plus 1.</p></li>
<li><p><em>personalityfn</em>: If non-zero, the value index of the personality function for this function,
plus 1.</p></li>
<li><p><em>preemptionspecifier</em>: If present, an encoding of the <a class="reference internal" href="#bcpreemptionspecifier"><span class="std std-ref">runtime preemption specifier</span></a>  of this function.</p></li>
</ul>
</div>
<div class="section" id="module-code-alias-record">
<h4><a class="toc-backref" href="#id45">MODULE_CODE_ALIAS Record</a><a class="headerlink" href="#module-code-alias-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[ALIAS,</span> <span class="pre">strtab</span> <span class="pre">offset,</span> <span class="pre">strtab</span> <span class="pre">size,</span> <span class="pre">alias</span> <span class="pre">type,</span> <span class="pre">aliasee</span> <span class="pre">val#,</span> <span class="pre">linkage,</span> <span class="pre">visibility,</span> <span class="pre">dllstorageclass,</span> <span class="pre">threadlocal,</span> <span class="pre">unnamed_addr,</span> <span class="pre">preemptionspecifier]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> record (code 9) marks the definition of an alias. The operand
fields are</p>
<ul class="simple">
<li><p><em>strtab offset</em>, <em>strtab size</em>: Specifies the name of the alias.
See <a class="reference internal" href="#strtab-block-contents">STRTAB_BLOCK Contents</a>.</p></li>
<li><p><em>alias type</em>: The type index of the alias</p></li>
<li><p><em>aliasee val#</em>: The value index of the aliased value</p></li>
<li><p><em>linkage</em>: An encoding of the <a class="reference internal" href="#linkage-type">linkage type</a> for this alias</p></li>
<li><p><em>visibility</em>: If present, an encoding of the <a class="reference internal" href="#visibility">visibility</a> of the alias</p></li>
<li><p><em>dllstorageclass</em>: If present, an encoding of the
<a class="reference internal" href="#bcdllstorageclass"><span class="std std-ref">dllstorageclass</span></a> of the alias</p></li>
<li><p><em>threadlocal</em>: If present, an encoding of the
<a class="reference internal" href="#bcthreadlocal"><span class="std std-ref">thread local property</span></a> of the alias</p></li>
<li><p><em>unnamed_addr</em>: If present, an encoding of the
<a class="reference internal" href="#bcunnamedaddr"><span class="std std-ref">unnamed_addr</span></a> attribute of this alias</p></li>
<li><p><em>preemptionspecifier</em>: If present, an encoding of the <a class="reference internal" href="#bcpreemptionspecifier"><span class="std std-ref">runtime preemption specifier</span></a>  of this alias.</p></li>
</ul>
</div>
<div class="section" id="module-code-gcname-record">
<span id="module-code-gcname"></span><h4><a class="toc-backref" href="#id46">MODULE_CODE_GCNAME Record</a><a class="headerlink" href="#module-code-gcname-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[GCNAME,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">GCNAME</span></code> record (code 11) contains a variable number of values
representing the bytes of a single garbage collector name string. There should
be one <code class="docutils literal notranslate"><span class="pre">GCNAME</span></code> record for each garbage collector name referenced in function
<code class="docutils literal notranslate"><span class="pre">gc</span></code> attributes within the module. These records can be referenced by 1-based
index in the <em>gc</em> fields of <code class="docutils literal notranslate"><span class="pre">FUNCTION</span></code> records.</p>
</div>
</div>
<div class="section" id="paramattr-block-contents">
<span id="paramattr-block"></span><h3><a class="toc-backref" href="#id47">PARAMATTR_BLOCK Contents</a><a class="headerlink" href="#paramattr-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">PARAMATTR_BLOCK</span></code> block (id 9) contains a table of entries describing the
attributes of function parameters. These entries are referenced by 1-based index
in the <em>paramattr</em> field of module block <a class="reference internal" href="#function">FUNCTION</a> records, or within the
<em>attr</em> field of function block <code class="docutils literal notranslate"><span class="pre">INST_INVOKE</span></code> and <code class="docutils literal notranslate"><span class="pre">INST_CALL</span></code> records.</p>
<p>Entries within <code class="docutils literal notranslate"><span class="pre">PARAMATTR_BLOCK</span></code> are constructed to ensure that each is unique
(i.e., no two indices represent equivalent attribute lists).</p>
<div class="section" id="paramattr-code-entry-record">
<span id="paramattr-code-entry"></span><h4><a class="toc-backref" href="#id48">PARAMATTR_CODE_ENTRY Record</a><a class="headerlink" href="#paramattr-code-entry-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[ENTRY,</span> <span class="pre">attrgrp0,</span> <span class="pre">attrgrp1,</span> <span class="pre">...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ENTRY</span></code> record (code 2) contains a variable number of values describing a
unique set of function parameter attributes. Each <em>attrgrp</em> value is used as a
key with which to look up an entry in the attribute group table described
in the <code class="docutils literal notranslate"><span class="pre">PARAMATTR_GROUP_BLOCK</span></code> block.</p>
</div>
<div class="section" id="paramattr-code-entry-old-record">
<span id="paramattr-code-entry-old"></span><h4><a class="toc-backref" href="#id49">PARAMATTR_CODE_ENTRY_OLD Record</a><a class="headerlink" href="#paramattr-code-entry-old-record" title="Permalink to this headline">¶</a></h4>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is a legacy encoding for attributes, produced by LLVM versions 3.2 and
earlier. It is guaranteed to be understood by the current LLVM version, as
specified in the <a class="reference internal" href="DeveloperPolicy.html#ir-backwards-compatibility"><span class="std std-ref">IR Backwards Compatibility</span></a> policy.</p>
</div>
<p><code class="docutils literal notranslate"><span class="pre">[ENTRY,</span> <span class="pre">paramidx0,</span> <span class="pre">attr0,</span> <span class="pre">paramidx1,</span> <span class="pre">attr1...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ENTRY</span></code> record (code 1) contains an even number of values describing a
unique set of function parameter attributes. Each <em>paramidx</em> value indicates
which set of attributes is represented, with 0 representing the return value
attributes, 0xFFFFFFFF representing function attributes, and other values
representing 1-based function parameters. Each <em>attr</em> value is a bitmap with the
following interpretation:</p>
<ul class="simple">
<li><p>bit 0: <code class="docutils literal notranslate"><span class="pre">zeroext</span></code></p></li>
<li><p>bit 1: <code class="docutils literal notranslate"><span class="pre">signext</span></code></p></li>
<li><p>bit 2: <code class="docutils literal notranslate"><span class="pre">noreturn</span></code></p></li>
<li><p>bit 3: <code class="docutils literal notranslate"><span class="pre">inreg</span></code></p></li>
<li><p>bit 4: <code class="docutils literal notranslate"><span class="pre">sret</span></code></p></li>
<li><p>bit 5: <code class="docutils literal notranslate"><span class="pre">nounwind</span></code></p></li>
<li><p>bit 6: <code class="docutils literal notranslate"><span class="pre">noalias</span></code></p></li>
<li><p>bit 7: <code class="docutils literal notranslate"><span class="pre">byval</span></code></p></li>
<li><p>bit 8: <code class="docutils literal notranslate"><span class="pre">nest</span></code></p></li>
<li><p>bit 9: <code class="docutils literal notranslate"><span class="pre">readnone</span></code></p></li>
<li><p>bit 10: <code class="docutils literal notranslate"><span class="pre">readonly</span></code></p></li>
<li><p>bit 11: <code class="docutils literal notranslate"><span class="pre">noinline</span></code></p></li>
<li><p>bit 12: <code class="docutils literal notranslate"><span class="pre">alwaysinline</span></code></p></li>
<li><p>bit 13: <code class="docutils literal notranslate"><span class="pre">optsize</span></code></p></li>
<li><p>bit 14: <code class="docutils literal notranslate"><span class="pre">ssp</span></code></p></li>
<li><p>bit 15: <code class="docutils literal notranslate"><span class="pre">sspreq</span></code></p></li>
<li><p>bits 16-31: <code class="docutils literal notranslate"><span class="pre">align</span> <span class="pre">n</span></code></p></li>
<li><p>bit 32: <code class="docutils literal notranslate"><span class="pre">nocapture</span></code></p></li>
<li><p>bit 33: <code class="docutils literal notranslate"><span class="pre">noredzone</span></code></p></li>
<li><p>bit 34: <code class="docutils literal notranslate"><span class="pre">noimplicitfloat</span></code></p></li>
<li><p>bit 35: <code class="docutils literal notranslate"><span class="pre">naked</span></code></p></li>
<li><p>bit 36: <code class="docutils literal notranslate"><span class="pre">inlinehint</span></code></p></li>
<li><p>bits 37-39: <code class="docutils literal notranslate"><span class="pre">alignstack</span> <span class="pre">n</span></code>, represented as the logarithm
base 2 of the requested alignment, plus 1</p></li>
</ul>
</div>
</div>
<div class="section" id="paramattr-group-block-contents">
<span id="paramattr-group-block"></span><h3><a class="toc-backref" href="#id50">PARAMATTR_GROUP_BLOCK Contents</a><a class="headerlink" href="#paramattr-group-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">PARAMATTR_GROUP_BLOCK</span></code> block (id 10) contains a table of entries
describing the attribute groups present in the module. These entries can be
referenced within <code class="docutils literal notranslate"><span class="pre">PARAMATTR_CODE_ENTRY</span></code> entries.</p>
<div class="section" id="paramattr-grp-code-entry-record">
<span id="paramattr-grp-code-entry"></span><h4><a class="toc-backref" href="#id51">PARAMATTR_GRP_CODE_ENTRY Record</a><a class="headerlink" href="#paramattr-grp-code-entry-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[ENTRY,</span> <span class="pre">grpid,</span> <span class="pre">paramidx,</span> <span class="pre">attr0,</span> <span class="pre">attr1,</span> <span class="pre">...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ENTRY</span></code> record (code 3) contains <em>grpid</em> and <em>paramidx</em> values, followed
by a variable number of values describing a unique group of attributes. The
<em>grpid</em> value is a unique key for the attribute group, which can be referenced
within <code class="docutils literal notranslate"><span class="pre">PARAMATTR_CODE_ENTRY</span></code> entries. The <em>paramidx</em> value indicates which
set of attributes is represented, with 0 representing the return value
attributes, 0xFFFFFFFF representing function attributes, and other values
representing 1-based function parameters.</p>
<p>Each <em>attr</em> is itself represented as a variable number of values:</p>
<p><code class="docutils literal notranslate"><span class="pre">kind,</span> <span class="pre">key</span> <span class="pre">[,</span> <span class="pre">...],</span> <span class="pre">[value</span> <span class="pre">[,</span> <span class="pre">...]]</span></code></p>
<p>Each attribute is either a well-known LLVM attribute (possibly with an integer
value associated with it), or an arbitrary string (possibly with an arbitrary
string value associated with it). The <em>kind</em> value is an integer code
distinguishing between these possibilities:</p>
<ul class="simple">
<li><p>code 0: well-known attribute</p></li>
<li><p>code 1: well-known attribute with an integer value</p></li>
<li><p>code 3: string attribute</p></li>
<li><p>code 4: string attribute with a string value</p></li>
</ul>
<p>For well-known attributes (code 0 or 1), the <em>key</em> value is an integer code
identifying the attribute. For attributes with an integer argument (code 1),
the <em>value</em> value indicates the argument.</p>
<p>For string attributes (code 3 or 4), the <em>key</em> value is actually a variable
number of values representing the bytes of a null-terminated string. For
attributes with a string argument (code 4), the <em>value</em> value is similarly a
variable number of values representing the bytes of a null-terminated string.</p>
<p>The integer codes are mapped to well-known attributes as follows.</p>
<ul class="simple">
<li><p>code 1: <code class="docutils literal notranslate"><span class="pre">align(&lt;n&gt;)</span></code></p></li>
<li><p>code 2: <code class="docutils literal notranslate"><span class="pre">alwaysinline</span></code></p></li>
<li><p>code 3: <code class="docutils literal notranslate"><span class="pre">byval</span></code></p></li>
<li><p>code 4: <code class="docutils literal notranslate"><span class="pre">inlinehint</span></code></p></li>
<li><p>code 5: <code class="docutils literal notranslate"><span class="pre">inreg</span></code></p></li>
<li><p>code 6: <code class="docutils literal notranslate"><span class="pre">minsize</span></code></p></li>
<li><p>code 7: <code class="docutils literal notranslate"><span class="pre">naked</span></code></p></li>
<li><p>code 8: <code class="docutils literal notranslate"><span class="pre">nest</span></code></p></li>
<li><p>code 9: <code class="docutils literal notranslate"><span class="pre">noalias</span></code></p></li>
<li><p>code 10: <code class="docutils literal notranslate"><span class="pre">nobuiltin</span></code></p></li>
<li><p>code 11: <code class="docutils literal notranslate"><span class="pre">nocapture</span></code></p></li>
<li><p>code 12: <code class="docutils literal notranslate"><span class="pre">noduplicates</span></code></p></li>
<li><p>code 13: <code class="docutils literal notranslate"><span class="pre">noimplicitfloat</span></code></p></li>
<li><p>code 14: <code class="docutils literal notranslate"><span class="pre">noinline</span></code></p></li>
<li><p>code 15: <code class="docutils literal notranslate"><span class="pre">nonlazybind</span></code></p></li>
<li><p>code 16: <code class="docutils literal notranslate"><span class="pre">noredzone</span></code></p></li>
<li><p>code 17: <code class="docutils literal notranslate"><span class="pre">noreturn</span></code></p></li>
<li><p>code 18: <code class="docutils literal notranslate"><span class="pre">nounwind</span></code></p></li>
<li><p>code 19: <code class="docutils literal notranslate"><span class="pre">optsize</span></code></p></li>
<li><p>code 20: <code class="docutils literal notranslate"><span class="pre">readnone</span></code></p></li>
<li><p>code 21: <code class="docutils literal notranslate"><span class="pre">readonly</span></code></p></li>
<li><p>code 22: <code class="docutils literal notranslate"><span class="pre">returned</span></code></p></li>
<li><p>code 23: <code class="docutils literal notranslate"><span class="pre">returns_twice</span></code></p></li>
<li><p>code 24: <code class="docutils literal notranslate"><span class="pre">signext</span></code></p></li>
<li><p>code 25: <code class="docutils literal notranslate"><span class="pre">alignstack(&lt;n&gt;)</span></code></p></li>
<li><p>code 26: <code class="docutils literal notranslate"><span class="pre">ssp</span></code></p></li>
<li><p>code 27: <code class="docutils literal notranslate"><span class="pre">sspreq</span></code></p></li>
<li><p>code 28: <code class="docutils literal notranslate"><span class="pre">sspstrong</span></code></p></li>
<li><p>code 29: <code class="docutils literal notranslate"><span class="pre">sret</span></code></p></li>
<li><p>code 30: <code class="docutils literal notranslate"><span class="pre">sanitize_address</span></code></p></li>
<li><p>code 31: <code class="docutils literal notranslate"><span class="pre">sanitize_thread</span></code></p></li>
<li><p>code 32: <code class="docutils literal notranslate"><span class="pre">sanitize_memory</span></code></p></li>
<li><p>code 33: <code class="docutils literal notranslate"><span class="pre">uwtable</span></code></p></li>
<li><p>code 34: <code class="docutils literal notranslate"><span class="pre">zeroext</span></code></p></li>
<li><p>code 35: <code class="docutils literal notranslate"><span class="pre">builtin</span></code></p></li>
<li><p>code 36: <code class="docutils literal notranslate"><span class="pre">cold</span></code></p></li>
<li><p>code 37: <code class="docutils literal notranslate"><span class="pre">optnone</span></code></p></li>
<li><p>code 38: <code class="docutils literal notranslate"><span class="pre">inalloca</span></code></p></li>
<li><p>code 39: <code class="docutils literal notranslate"><span class="pre">nonnull</span></code></p></li>
<li><p>code 40: <code class="docutils literal notranslate"><span class="pre">jumptable</span></code></p></li>
<li><p>code 41: <code class="docutils literal notranslate"><span class="pre">dereferenceable(&lt;n&gt;)</span></code></p></li>
<li><p>code 42: <code class="docutils literal notranslate"><span class="pre">dereferenceable_or_null(&lt;n&gt;)</span></code></p></li>
<li><p>code 43: <code class="docutils literal notranslate"><span class="pre">convergent</span></code></p></li>
<li><p>code 44: <code class="docutils literal notranslate"><span class="pre">safestack</span></code></p></li>
<li><p>code 45: <code class="docutils literal notranslate"><span class="pre">argmemonly</span></code></p></li>
<li><p>code 46: <code class="docutils literal notranslate"><span class="pre">swiftself</span></code></p></li>
<li><p>code 47: <code class="docutils literal notranslate"><span class="pre">swifterror</span></code></p></li>
<li><p>code 48: <code class="docutils literal notranslate"><span class="pre">norecurse</span></code></p></li>
<li><p>code 49: <code class="docutils literal notranslate"><span class="pre">inaccessiblememonly</span></code></p></li>
<li><p>code 50: <code class="docutils literal notranslate"><span class="pre">inaccessiblememonly_or_argmemonly</span></code></p></li>
<li><p>code 51: <code class="docutils literal notranslate"><span class="pre">allocsize(&lt;EltSizeParam&gt;[,</span> <span class="pre">&lt;NumEltsParam&gt;])</span></code></p></li>
<li><p>code 52: <code class="docutils literal notranslate"><span class="pre">writeonly</span></code></p></li>
<li><p>code 53: <code class="docutils literal notranslate"><span class="pre">speculatable</span></code></p></li>
<li><p>code 54: <code class="docutils literal notranslate"><span class="pre">strictfp</span></code></p></li>
<li><p>code 55: <code class="docutils literal notranslate"><span class="pre">sanitize_hwaddress</span></code></p></li>
<li><p>code 56: <code class="docutils literal notranslate"><span class="pre">nocf_check</span></code></p></li>
<li><p>code 57: <code class="docutils literal notranslate"><span class="pre">optforfuzzing</span></code></p></li>
<li><p>code 58: <code class="docutils literal notranslate"><span class="pre">shadowcallstack</span></code></p></li>
<li><p>code 64: <code class="docutils literal notranslate"><span class="pre">sanitize_memtag</span></code></p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The <code class="docutils literal notranslate"><span class="pre">allocsize</span></code> attribute has a special encoding for its arguments. Its two
arguments, which are 32-bit integers, are packed into one 64-bit integer value
(i.e. <code class="docutils literal notranslate"><span class="pre">(EltSizeParam</span> <span class="pre">&lt;&lt;</span> <span class="pre">32)</span> <span class="pre">|</span> <span class="pre">NumEltsParam</span></code>), with <code class="docutils literal notranslate"><span class="pre">NumEltsParam</span></code> taking on
the sentinel value -1 if it is not specified.</p>
</div>
</div>
</div>
<div class="section" id="type-block-contents">
<span id="type-block"></span><h3><a class="toc-backref" href="#id52">TYPE_BLOCK Contents</a><a class="headerlink" href="#type-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">TYPE_BLOCK</span></code> block (id 17) contains records which constitute a table of
type operator entries used to represent types referenced within an LLVM
module. Each record (with the exception of <a class="reference internal" href="#numentry">NUMENTRY</a>) generates a single type
table entry, which may be referenced by 0-based index from instructions,
constants, metadata, type symbol table entries, or other type operator records.</p>
<p>Entries within <code class="docutils literal notranslate"><span class="pre">TYPE_BLOCK</span></code> are constructed to ensure that each entry is
unique (i.e., no two indices represent structurally equivalent types).</p>
<div class="section" id="type-code-numentry-record">
<span id="numentry"></span><span id="type-code-numentry"></span><h4><a class="toc-backref" href="#id53">TYPE_CODE_NUMENTRY Record</a><a class="headerlink" href="#type-code-numentry-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[NUMENTRY,</span> <span class="pre">numentries]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">NUMENTRY</span></code> record (code 1) contains a single value which indicates the
total number of type code entries in the type table of the module. If present,
<code class="docutils literal notranslate"><span class="pre">NUMENTRY</span></code> should be the first record in the block.</p>
</div>
<div class="section" id="type-code-void-record">
<h4><a class="toc-backref" href="#id54">TYPE_CODE_VOID Record</a><a class="headerlink" href="#type-code-void-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[VOID]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">VOID</span></code> record (code 2) adds a <code class="docutils literal notranslate"><span class="pre">void</span></code> type to the type table.</p>
</div>
<div class="section" id="type-code-half-record">
<h4><a class="toc-backref" href="#id55">TYPE_CODE_HALF Record</a><a class="headerlink" href="#type-code-half-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[HALF]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">HALF</span></code> record (code 10) adds a <code class="docutils literal notranslate"><span class="pre">half</span></code> (16-bit floating point) type to
the type table.</p>
</div>
<div class="section" id="type-code-float-record">
<h4><a class="toc-backref" href="#id56">TYPE_CODE_FLOAT Record</a><a class="headerlink" href="#type-code-float-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[FLOAT]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">FLOAT</span></code> record (code 3) adds a <code class="docutils literal notranslate"><span class="pre">float</span></code> (32-bit floating point) type to
the type table.</p>
</div>
<div class="section" id="type-code-double-record">
<h4><a class="toc-backref" href="#id57">TYPE_CODE_DOUBLE Record</a><a class="headerlink" href="#type-code-double-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[DOUBLE]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">DOUBLE</span></code> record (code 4) adds a <code class="docutils literal notranslate"><span class="pre">double</span></code> (64-bit floating point) type to
the type table.</p>
</div>
<div class="section" id="type-code-label-record">
<h4><a class="toc-backref" href="#id58">TYPE_CODE_LABEL Record</a><a class="headerlink" href="#type-code-label-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[LABEL]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">LABEL</span></code> record (code 5) adds a <code class="docutils literal notranslate"><span class="pre">label</span></code> type to the type table.</p>
</div>
<div class="section" id="type-code-opaque-record">
<h4><a class="toc-backref" href="#id59">TYPE_CODE_OPAQUE Record</a><a class="headerlink" href="#type-code-opaque-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[OPAQUE]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">OPAQUE</span></code> record (code 6) adds an <code class="docutils literal notranslate"><span class="pre">opaque</span></code> type to the type table, with
a name defined by a previously encountered <code class="docutils literal notranslate"><span class="pre">STRUCT_NAME</span></code> record. Note that
distinct <code class="docutils literal notranslate"><span class="pre">opaque</span></code> types are not unified.</p>
</div>
<div class="section" id="type-code-integer-record">
<h4><a class="toc-backref" href="#id60">TYPE_CODE_INTEGER Record</a><a class="headerlink" href="#type-code-integer-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[INTEGER,</span> <span class="pre">width]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">INTEGER</span></code> record (code 7) adds an integer type to the type table. The
single <em>width</em> field indicates the width of the integer type.</p>
</div>
<div class="section" id="type-code-pointer-record">
<h4><a class="toc-backref" href="#id61">TYPE_CODE_POINTER Record</a><a class="headerlink" href="#type-code-pointer-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[POINTER,</span> <span class="pre">pointee</span> <span class="pre">type,</span> <span class="pre">address</span> <span class="pre">space]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">POINTER</span></code> record (code 8) adds a pointer type to the type table. The
operand fields are</p>
<ul class="simple">
<li><p><em>pointee type</em>: The type index of the pointed-to type</p></li>
<li><p><em>address space</em>: If supplied, the target-specific numbered address space where
the pointed-to object resides. Otherwise, the default address space is zero.</p></li>
</ul>
</div>
<div class="section" id="type-code-function-old-record">
<h4><a class="toc-backref" href="#id62">TYPE_CODE_FUNCTION_OLD Record</a><a class="headerlink" href="#type-code-function-old-record" title="Permalink to this headline">¶</a></h4>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is a legacy encoding for functions, produced by LLVM versions 3.0 and
earlier. It is guaranteed to be understood by the current LLVM version, as
specified in the <a class="reference internal" href="DeveloperPolicy.html#ir-backwards-compatibility"><span class="std std-ref">IR Backwards Compatibility</span></a> policy.</p>
</div>
<p><code class="docutils literal notranslate"><span class="pre">[FUNCTION_OLD,</span> <span class="pre">vararg,</span> <span class="pre">ignored,</span> <span class="pre">retty,</span> <span class="pre">...paramty...</span> <span class="pre">]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">FUNCTION_OLD</span></code> record (code 9) adds a function type to the type table.
The operand fields are</p>
<ul class="simple">
<li><p><em>vararg</em>: Non-zero if the type represents a varargs function</p></li>
<li><p><em>ignored</em>: This value field is present for backward compatibility only, and is
ignored</p></li>
<li><p><em>retty</em>: The type index of the function’s return type</p></li>
<li><p><em>paramty</em>: Zero or more type indices representing the parameter types of the
function</p></li>
</ul>
</div>
<div class="section" id="type-code-array-record">
<h4><a class="toc-backref" href="#id63">TYPE_CODE_ARRAY Record</a><a class="headerlink" href="#type-code-array-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[ARRAY,</span> <span class="pre">numelts,</span> <span class="pre">eltty]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">ARRAY</span></code> record (code 11) adds an array type to the type table.  The
operand fields are</p>
<ul class="simple">
<li><p><em>numelts</em>: The number of elements in arrays of this type</p></li>
<li><p><em>eltty</em>: The type index of the array element type</p></li>
</ul>
</div>
<div class="section" id="type-code-vector-record">
<h4><a class="toc-backref" href="#id64">TYPE_CODE_VECTOR Record</a><a class="headerlink" href="#type-code-vector-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[VECTOR,</span> <span class="pre">numelts,</span> <span class="pre">eltty]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">VECTOR</span></code> record (code 12) adds a vector type to the type table.  The
operand fields are</p>
<ul class="simple">
<li><p><em>numelts</em>: The number of elements in vectors of this type</p></li>
<li><p><em>eltty</em>: The type index of the vector element type</p></li>
</ul>
</div>
<div class="section" id="type-code-x86-fp80-record">
<h4><a class="toc-backref" href="#id65">TYPE_CODE_X86_FP80 Record</a><a class="headerlink" href="#type-code-x86-fp80-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[X86_FP80]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">X86_FP80</span></code> record (code 13) adds an <code class="docutils literal notranslate"><span class="pre">x86_fp80</span></code> (80-bit floating point)
type to the type table.</p>
</div>
<div class="section" id="type-code-fp128-record">
<h4><a class="toc-backref" href="#id66">TYPE_CODE_FP128 Record</a><a class="headerlink" href="#type-code-fp128-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[FP128]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">FP128</span></code> record (code 14) adds an <code class="docutils literal notranslate"><span class="pre">fp128</span></code> (128-bit floating point) type
to the type table.</p>
</div>
<div class="section" id="type-code-ppc-fp128-record">
<h4><a class="toc-backref" href="#id67">TYPE_CODE_PPC_FP128 Record</a><a class="headerlink" href="#type-code-ppc-fp128-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[PPC_FP128]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">PPC_FP128</span></code> record (code 15) adds a <code class="docutils literal notranslate"><span class="pre">ppc_fp128</span></code> (128-bit floating point)
type to the type table.</p>
</div>
<div class="section" id="type-code-metadata-record">
<h4><a class="toc-backref" href="#id68">TYPE_CODE_METADATA Record</a><a class="headerlink" href="#type-code-metadata-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[METADATA]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">METADATA</span></code> record (code 16) adds a <code class="docutils literal notranslate"><span class="pre">metadata</span></code> type to the type table.</p>
</div>
<div class="section" id="type-code-x86-mmx-record">
<h4><a class="toc-backref" href="#id69">TYPE_CODE_X86_MMX Record</a><a class="headerlink" href="#type-code-x86-mmx-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[X86_MMX]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">X86_MMX</span></code> record (code 17) adds an <code class="docutils literal notranslate"><span class="pre">x86_mmx</span></code> type to the type table.</p>
</div>
<div class="section" id="type-code-struct-anon-record">
<h4><a class="toc-backref" href="#id70">TYPE_CODE_STRUCT_ANON Record</a><a class="headerlink" href="#type-code-struct-anon-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[STRUCT_ANON,</span> <span class="pre">ispacked,</span> <span class="pre">...eltty...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">STRUCT_ANON</span></code> record (code 18) adds a literal struct type to the type
table. The operand fields are</p>
<ul class="simple">
<li><p><em>ispacked</em>: Non-zero if the type represents a packed structure</p></li>
<li><p><em>eltty</em>: Zero or more type indices representing the element types of the
structure</p></li>
</ul>
</div>
<div class="section" id="type-code-struct-name-record">
<h4><a class="toc-backref" href="#id71">TYPE_CODE_STRUCT_NAME Record</a><a class="headerlink" href="#type-code-struct-name-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[STRUCT_NAME,</span> <span class="pre">...string...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">STRUCT_NAME</span></code> record (code 19) contains a variable number of values
representing the bytes of a struct name. The next <code class="docutils literal notranslate"><span class="pre">OPAQUE</span></code> or
<code class="docutils literal notranslate"><span class="pre">STRUCT_NAMED</span></code> record will use this name.</p>
</div>
<div class="section" id="type-code-struct-named-record">
<h4><a class="toc-backref" href="#id72">TYPE_CODE_STRUCT_NAMED Record</a><a class="headerlink" href="#type-code-struct-named-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[STRUCT_NAMED,</span> <span class="pre">ispacked,</span> <span class="pre">...eltty...]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">STRUCT_NAMED</span></code> record (code 20) adds an identified struct type to the
type table, with a name defined by a previously encountered <code class="docutils literal notranslate"><span class="pre">STRUCT_NAME</span></code>
record. The operand fields are</p>
<ul class="simple">
<li><p><em>ispacked</em>: Non-zero if the type represents a packed structure</p></li>
<li><p><em>eltty</em>: Zero or more type indices representing the element types of the
structure</p></li>
</ul>
</div>
<div class="section" id="type-code-function-record">
<h4><a class="toc-backref" href="#id73">TYPE_CODE_FUNCTION Record</a><a class="headerlink" href="#type-code-function-record" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">[FUNCTION,</span> <span class="pre">vararg,</span> <span class="pre">retty,</span> <span class="pre">...paramty...</span> <span class="pre">]</span></code></p>
<p>The <code class="docutils literal notranslate"><span class="pre">FUNCTION</span></code> record (code 21) adds a function type to the type table. The
operand fields are</p>
<ul class="simple">
<li><p><em>vararg</em>: Non-zero if the type represents a varargs function</p></li>
<li><p><em>retty</em>: The type index of the function’s return type</p></li>
<li><p><em>paramty</em>: Zero or more type indices representing the parameter types of the
function</p></li>
</ul>
</div>
</div>
<div class="section" id="constants-block-contents">
<span id="constants-block"></span><h3><a class="toc-backref" href="#id74">CONSTANTS_BLOCK Contents</a><a class="headerlink" href="#constants-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">CONSTANTS_BLOCK</span></code> block (id 11) …</p>
</div>
<div class="section" id="function-block-contents">
<span id="function-block"></span><h3><a class="toc-backref" href="#id75">FUNCTION_BLOCK Contents</a><a class="headerlink" href="#function-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">FUNCTION_BLOCK</span></code> block (id 12) …</p>
<p>In addition to the record types described below, a <code class="docutils literal notranslate"><span class="pre">FUNCTION_BLOCK</span></code> block may
contain the following sub-blocks:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#constants-block">CONSTANTS_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#value-symtab-block">VALUE_SYMTAB_BLOCK</a></p></li>
<li><p><a class="reference internal" href="#metadata-attachment">METADATA_ATTACHMENT</a></p></li>
</ul>
</div>
<div class="section" id="value-symtab-block-contents">
<span id="value-symtab-block"></span><h3><a class="toc-backref" href="#id76">VALUE_SYMTAB_BLOCK Contents</a><a class="headerlink" href="#value-symtab-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">VALUE_SYMTAB_BLOCK</span></code> block (id 14) …</p>
</div>
<div class="section" id="metadata-block-contents">
<span id="metadata-block"></span><h3><a class="toc-backref" href="#id77">METADATA_BLOCK Contents</a><a class="headerlink" href="#metadata-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">METADATA_BLOCK</span></code> block (id 15) …</p>
</div>
<div class="section" id="metadata-attachment-contents">
<span id="metadata-attachment"></span><h3><a class="toc-backref" href="#id78">METADATA_ATTACHMENT Contents</a><a class="headerlink" href="#metadata-attachment-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">METADATA_ATTACHMENT</span></code> block (id 16) …</p>
</div>
<div class="section" id="strtab-block-contents">
<span id="strtab-block"></span><h3><a class="toc-backref" href="#id79">STRTAB_BLOCK Contents</a><a class="headerlink" href="#strtab-block-contents" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">STRTAB</span></code> block (id 23) contains a single record (<code class="docutils literal notranslate"><span class="pre">STRTAB_BLOB</span></code>, id 1)
with a single blob operand containing the bitcode file’s string table.</p>
<p>Strings in the string table are not null terminated. A record’s <em>strtab
offset</em> and <em>strtab size</em> operands specify the byte offset and size of a
string within the string table.</p>
<p>The string table is used by all preceding blocks in the bitcode file that are
not succeeded by another intervening <code class="docutils literal notranslate"><span class="pre">STRTAB</span></code> block. Normally a bitcode
file will have a single string table, but it may have more than one if it
was created by binary concatenation of multiple bitcode files.</p>
</div>
</div>
</div>


            <div class="clearer"></div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="BlockFrequencyTerminology.html" title="LLVM Block Frequency Terminology"
             >next</a> |</li>
        <li class="right" >
          <a href="MemorySSA.html" title="MemorySSA"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>

        <li class="nav-item nav-item-this"><a href="">LLVM Bitcode File Format</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2003-2020, LLVM Project.
      Last updated on 2020-09-20.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
    </div>
  </body>
</html>